﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>

    <div id="idListAllIncomes" style="border-bottom:1px solid black;">
        <h3 id="idHeaderText"></h3>
        <img class="cWaiting" src="MetroUI/images/preloader-w8-line-black.gif" /> 
        <ul class="listview fluid"> </ul>
        <div id="idShowMoreIncomes" style="width:80%; height:35px; border:1px dotted black; background-color:Gray; margin-left:auto; margin-right:auto; " >
            <h4 style='cursor:pointer; color:White; text-align:center;' id ='idShowMoreRecords'> 
            </h4>
        </div>
    </div> 

</body>
<script type="text/javascript">

    var shown = 0;
    var total = 0;
    var left = 0;
    
    //init. is done
    $(document).ready(function ()
    {
        var txtHeader = $('#idHeaderText');
        switch (CurrentStep)
        {
            case "AddIncome":
                txtHeader.html('All Incomes');
                break;
            case "AddExpense":
                txtHeader.html('All Expenses');
                break;
        }

        $.ajax({
            type: "POST",
            url: "General.ashx",
            data: "mode=GetRecords&type=" + CurrentStep + "&start=0&end=" + MaxRecords,
            async: false,
            success: function (data)
            {
                var result = eval('(' + data + ')');
                GenerateMoreRecords(result, $('#idShowMoreRecords'));
            }
        });

        $('.model').click(function ()
        {
            modelAction($(this));
        });


        $('#idShowMoreRecords').click(function ()
        {
            $('#idShowMoreRecords').html('Loading more records....');
            var start = shown;
            //load next page records
            $.ajax({
                type: "POST",
                url: "General.ashx",
                data: "mode=GetRecords&type=" + CurrentStep + "&start=" + start + "&end=" + (start + MaxRecords),
                async: false,
                success: function (data)
                {
                    var result = eval('(' + data + ')');
                    GenerateMoreRecords(result, $('#idShowMoreRecords'));
                }
            });
        });
    });
</script>
</html>
